//
//  Event.m
//  SlashEM
//
//  Created by dirk on 12/31/09.
//  Copyright 2009 Dirk Zimmermann. All rights reserved.
//

//  This file is part of Slash'EM.
//
//  Slash'EM is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, version 2 of the License only.
//
//  Slash'EM is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with Slash'EM.  If not, see <http://www.gnu.org/licenses/>.

#import "NhEvent.h"

#include "hack.h"

@implementation NhEvent

@synthesize key, mod, x, y;

+ (id) eventWithKey:(int)k mod:(int)m x:(int)i y:(int)j {
	return [[[self alloc] initWithKey:k mod:m x:i y:j] autorelease];
}

+ (id) eventWithKey:(int)k {
	return [[[self alloc] initWithKey:k] autorelease];
}

- (id) initWithKey:(int)k mod:(int)m x:(int)i y:(int)j {
	if (self = [super init]) {
		key = k;
		mod = m;
		x = i;
		y = j;
	}
	return self;
}

- (id) initWithKey:(int)k {
	if (self = [self initWithKey:k mod:-1 x:-1 y:-1]) {
	}
	return self;
}

- (BOOL) isKeyEvent {
	return key != 0;
}

- (void) dealloc {
	//NSLog(@"%@ dealloc", self);
	[super dealloc];
}

@end
